//
//  SDNetRequestFactory.m
//  SDDataTest
//
//  Created by ding wei on 12-10-4.
//  Copyright (c) 2012年 sodao. All rights reserved.
//

#import "SDNetURLMap.h"

@implementation SDNetURLMap
@synthesize APPKey = _APPKey;
-(NSString*)APPKey{
    return [self->urlAndParams objectForKey:RequestAppKey];
}
@synthesize token = _token;
-(NSString*)token{
    return [self->urlAndParams objectForKey:RequestToken];
}
@synthesize baseTestURL = _baseTestURL;
-(NSString*)baseTestURL{
    return [self->urlAndParams objectForKey:RequestBaseTestURL];
}
@synthesize baseURL = _baseURL;
-(NSString*)baseURL{
    return [self->urlAndParams objectForKey:RequestBaseURL];
}

-(id)init{
    self = [super init];
    if (!!self) {
        NSString* path = [[NSBundle mainBundle] pathForResource:@"URLPropertyList" ofType:@"plist"];
        self->urlAndParams = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
    }
    return self;
}
-(NSString*)uriByKey:(NSString*)key{
    NSDictionary* dic = [urlAndParams objectForKey:key];
    return [dic objectForKey:RequestParams_URI];
}
-(RequestType)typeByKey:(NSString*)key{
    NSDictionary* dic = [urlAndParams objectForKey:key];
    return [[dic objectForKey:RequestParams_type] intValue];
}
-(NSArray*)getParams:(NSString*)key{
    NSDictionary* dic = [urlAndParams objectForKey:key];
    return [dic objectForKey:RequestParams_getParams];
}
-(NSArray*)postParams:(NSString*)key{
    NSDictionary* dic = [urlAndParams objectForKey:key];
    return [dic objectForKey:RequestParams_postParams];
}
-(NSArray*)restParams:(NSString*)key{
    NSDictionary* dic = [urlAndParams objectForKey:key];
    return [dic objectForKey:RequestParams_restParams];
}

@end
